Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation updates for 0.16 #864

Merged
merged 17 commits into from
Feb 26, 2025
Merged

Documentation updates for 0.16 #864

merged 17 commits into from
Feb 26, 2025

Conversation

davesnx
Copy link
Member

@davesnx davesnx commented Nov 20, 2024

  • Rename ReactEvent to React.Event (fixes ReactEvent -> React.Event in docs #831)
  • Removes JSX2
  • Removes deprecated APIs
  • Changes bs.attributes to mel
  • Promotes "Hooks" as a toplevel on the sidebar
  • Updates Melange links to v4
  • Remove "you prefer to be surprised with runtime errors"

@@ -113,7 +113,7 @@ Reason also always opts for the safest form of a given hook as well. So `React.u

## Hand-writing components

You don't need to use the `[@react.component]` declaration to write components. Instead you can write a pair of `foo` and `fooProps` functions such that `type fooProps: 'a => props and foo: props => React.element` and these will always work as React components! This works with your own version of [`[@bs.obj]`](https://melange.re/v2.0.0/communicate-with-javascript/#using-jst-objects), [`[bs.deriving abstract]`](https://melange.re/v2.0.0/communicate-with-javascript/#convert-records-into-abstract-types), or any other function that takes named args and returns a single props structure.
You don't need to use the `[@react.component]` declaration to write components. Instead you can write a pair of `foo` and `fooProps` functions such that `type fooProps: 'a => props and foo: props => React.element` and these will always work as React components! This works with your own version of [`[@mel.obj]`](https://melange.re/v4.0.0/communicate-with-javascript#using-js-t-objects), [`[bs.deriving abstract]`](https://melange.re/v4.0.0/communicate-with-javascript#using-external-functions), or any other function that takes named args and returns a single props structure.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may need some kind of way to centrally update the melange version that we talk about.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, maybe move all links into references might make our lives easier, but having a link that points to "latest" might be a better idea

docs/context.md Outdated
};
```

That will give you a `ContextProvider` component you can use in your application later on, by wrapping any component with `ContextProvider`, to have access to the context value inside the component tree. To know more about Context, check the [official React documentation](https://legacy.reactjs.org/docs/context.html) and [when to use it](https://react.dev/learn/passing-data-deeply-with-context).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we update the legacy doc to https://react.dev/reference/react/createContext?


- `renderToString` : `React.element => string`
- `renderToStaticMarkup` : `React.element => string`

More info about `ReactDOMServer` can be found in the [official React documentation](https://react.dev/reference/react-dom/server).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add a small section about ReactDOMServerNode, which you can get by depending on reason-react.node

@@ -15,13 +15,13 @@ This likely means that:
This is a common mistake. Please see Melange's [Import an ES6 Default Value](https://melange.re/v2.0.0/communicate-with-javascript/#default-es6-values). Aka, instead of:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw you updated the link to point to v4 above. we should likely update the melange doc links across the entire docs to be consistent, in that case.

};
```

## Using Event values with useState
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicated from docs/usestate-event-value.md. are you planning to delete that page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, great catch!

davesnx and others added 10 commits February 26, 2025 12:12
Co-authored-by: Antonio Nuno Monteiro <[email protected]>
Co-authored-by: Antonio Nuno Monteiro <[email protected]>
Co-authored-by: Antonio Nuno Monteiro <[email protected]>
Co-authored-by: Antonio Nuno Monteiro <[email protected]>
@davesnx davesnx marked this pull request as ready for review February 26, 2025 15:59
@davesnx davesnx merged commit 2452ff8 into main Feb 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReactEvent -> React.Event in docs
2 participants